package com.ruoyi.detection.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.detection.domain.DetectionLog;
import com.ruoyi.detection.mapper.ModelMapper;
import com.ruoyi.detection.service.ModelService;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.topInsectImg.domain.WebFrontEnd;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Mr-Le
 */
@Service
public class ModelServiceImpl implements ModelService {

    @Autowired
    private TokenService tokenService;

    @Autowired
    private ModelMapper modelMapper;


    /**
     * 新增图片检测信息
     * @param detectionLog  对象
     * @return 结果
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int insertDetectionLog(DetectionLog detectionLog) {
        detectionLog.setCreateTime(DateUtils.getNowDate());
        return modelMapper.insertDetectionLog(detectionLog);
    }

    /**
     * 更新发送前端的对象，新增 检测结果 相关信息
     * @param webFrontEnd
     * @return
     */
    @Override
    public int updateWebFrontEnd(WebFrontEnd webFrontEnd) {
        return modelMapper.updateWebFrontEnd(webFrontEnd);
    }
}
